# -*- coding: iso-8859-2 -*-

from authorshipanalyzer.slot import Filler
from authorshipanalyzer.analyze import FooterAnalyzer

class StructureFeaturesFiller(Filler):
    '''
    Class dedicated to fill slot with features associated with
    the structure of email
    '''
    
    def __init__(self):
        self.analyzer = FooterAnalyzer()
    
    def fill(self, slot):
        '''
        Fill a slot with:
        - requotation type
        - greeting
        - text
        - farewell
        - signature
        - hasAdvert
        '''
        
        # copy requtoation type from message
        slot.requotationType = slot.message.getRequotationType()

        # fill analyzer with message and divide text into parts
        self.analyzer.divide(slot.message)

        # fill slot with defined parts
        slot.greeting = self.analyzer.greeting
        slot.farewell = self.analyzer.farewell
        slot.text = self.analyzer.text
        slot.signature = self.analyzer.signature
        slot.hasAdvert = self.analyzer.hasAdvert
    
    